package entity;

import java.util.Objects;

/**
 * @author 大定府羡民（QQ：1032694760）
 */
public class Region {
    public String code;
    public String name;
    public Integer level;
    public String levelName;
    public String parentCode;
    public String version;

    @Override
    public boolean equals(Object object) {
        if (this == object) {
            return true;
        }
        if (!(object instanceof Region region)) {
            return false;
        }
        return Objects.equals(code, region.code);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(code);
    }

    public enum Level {
        UNKNOWN(-1),
        COUNTRY(0),
        PROVINCE(1),
        CITY(2),
        COUNTY(3),
        ;

        private final int value;

        Level(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }

    }

}
